package com.wc.alorithm_blue_bridge._DFS.Q3817;

import java.util.*;

/**
 * @Author congege
 * @Description 混境之地2
 * https://www.lanqiao.cn/problems/3817/learning/?page=1&first_category_id=1
 * @Date Created in 2023/11/28-22:54
 */
public class Main {
    static char[][] map;
    static boolean[][] vis;
    static int n;
    static int m;
    static int startX;
    static int startY;
    static int endX;
    static int endY;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        n = Integer.parseInt(scan.next());
        m = Integer.parseInt(scan.next());

        startX = Integer.parseInt(scan.next()) - 1;
        startY = Integer.parseInt(scan.next()) - 1;
        endX = Integer.parseInt(scan.next()) - 1;
        endY = Integer.parseInt(scan.next()) - 1;

        map = new char[n][];
        vis = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            String row = scan.next();
            map[i] = row.toCharArray();
        }
        boolean ans = false;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (map[i][j] == '#') {
                    map[i][j] = '.';
                    vis = new boolean[n][m];
                    vis[startX][startY] = true;
                    if (dfs(startX, startY)) {
                        ans = true;
                        break;
                    }
                    map[i][j] = '#';
                }
            }
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        scan.close();
    }

    public static boolean dfs(int x, int y) {

        if (x == endX && y == endY) {
            return true;
        }


        int up = x - 1;
        int down = x + 1;
        int left = y - 1;
        int right = y + 1;
        boolean ans = false;
        // 上
        if (!isBound(up, y) && map[up][y] == '.' && !vis[up][y]) {
            vis[up][y] = true;
            ans = dfs(up, y);
            if (ans) {
                return true;
            }
        }
        // 下
        if (!isBound(down, y) && map[down][y] == '.' && !vis[down][y]) {
            vis[down][y] = true;
            ans = dfs(down, y);
            if (ans) {
                return true;
            }
        }
        // 左
        if (!isBound(x, left) && map[x][left] == '.' && !vis[x][left]) {
            vis[x][left] = true;
            ans = dfs(x, left);
            if (ans) {
                return true;
            }
        }

        // 右
        if (!isBound(x, right) && map[x][right] == '.' && !vis[x][right]) {
            vis[x][right] = true;
            ans = dfs(x, right);
            if (ans) {
                return true;
            }
        }


        return false;
    }

    public static boolean isBound(int x, int y) {
        if (x < 0 || x == n || y < 0 || y == m) {
            return true;
        }
        return false;
    }
}